/**
 * @Author: 李文浩
 * @Date: 2019/8/15
 * @Last Modified by:   李文浩
 * @Last Modified time: 2019-08-15 15:45:00
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 维修项目主类查询
export const getMainGroupList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups`, { params });

// 维修项目二级分类查询
export const getSubGroupList = (mainGroupCode, params) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups/${mainGroupCode}/subgroups`, params);

// 维修项目主类新增
export const addMainGroup = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups`, params);

// 维修项目二级分类新增
export const addSubGroup = (mainGroupCode, params) => axios.post(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups/${mainGroupCode}/subgroups`, params);

// 维修项目主类修改
export const editMainGroup = (mainGroupCode, params) => axios.put(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups/${mainGroupCode}`, params);

// 维修项目二级分类修改
export const editSubGroup = (subGroupCode, params) => axios.put(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups//${subGroupCode}/subgroups`, params);

// 维修项目主类 单查询
export const getMainGroup = (mainGroupCode, params) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups/${mainGroupCode}`, params);

// 维修项目二级分类 单查询
export const getSubGroup = (subGroupCode, params) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/labourgroups/${subGroupCode}/subgroupsinfo`, params);
